package com.yunhe.java.day03;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/7/20 0020.
 */
public class Date1 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入查询日期");
        int a=scanner.nextInt();
        int b=scanner.nextInt();
        int c=scanner.nextInt();
        int day= calcDate(a,b,c);
       int s=0;
        if ((a% 4 == 0) && (a % 100 != 0) || a% 400 == 0){
           s=366-day;
        }else{
            s=365-day;

        }System.out.println(a+"年还有"+s+"天");


    }
    public static int calcDate(int year, int month, int day) {
        int total = 0;
        for (int i = 1; i < month; i++) {
            int days;
            switch (i) {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12: {
                    days = 31;
                }
                break;
                case 2: {
                    days = 28;
                    if ((year % 4 == 0) && (year % 100 != 0) || year % 400 == 0) {
                        days = 29;
                    }
                }break;
                case 4:
                case 6:
                case 9:
                case 11: {
                    days = 30;
                    break;
                }
                default:days = 30;
            }

            total += days;
        }

        return total + day;
    }
}

